UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gAPBAMZZpQ4N1JtUEpcpmrOS5X66qItVRNwBJJ3ROGk='
WHERE
key_id = 'c4777f1024c11d1e44b7bdf99ce3e8f180c7a4375ed9f0cb94a7c82adff17e50'
AND (
token = 'gAPBAMZZpQ4N1JtUEpcpmrOS5X66qItVRNwBJJ3ROGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)