UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UNz2qWtrm0kmu6q+YfLj7fYlFVuNtwoj6rtXGMyXMxM='
WHERE
key_id = '78ba4ddc2849f95f3a44a5112734111b983b243be8c1e45a5e9559aa123f750b'
AND (
token = 'UNz2qWtrm0kmu6q+YfLj7fYlFVuNtwoj6rtXGMyXMxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)