UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Dva6cFYz29W89y0h4DAZefPkqsbnO+RM4xm6YOlPcgA='
WHERE
key_id = 'e67f97d72326d8992da0f77a865501e09b993f9936dae2862f24f02b5b4633f8'
AND (
token = 'Dva6cFYz29W89y0h4DAZefPkqsbnO+RM4xm6YOlPcgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)