UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4o1eegS9QZb5pCRcJ1FXlWXmtzXtH8VkOVtYUmLyDa8='
WHERE
key_id = '2595cd92197b3fcd322a101f7912353044f351c0d077a090b180a33d1d7b3ca8'
AND (
token = '4o1eegS9QZb5pCRcJ1FXlWXmtzXtH8VkOVtYUmLyDa8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)