UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S3gr0w7vpZ0HZRnIeJ82t4voQ+Iy7AsK/lcmTqZtBK8='
WHERE
key_id = '8498036497c29abc20fadf021b5a70931708e74ee82d2e43418b131c7f1fca59'
AND (
token = 'S3gr0w7vpZ0HZRnIeJ82t4voQ+Iy7AsK/lcmTqZtBK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)