UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YyAVGEDNf3yC4JayCS8Qx0vPrzuoqWRHQb8ROqOcFuM='
WHERE
key_id = '20040d983bfd0d0cf087980f335da948eca8546d5de932ee289c9e81a99e6142'
AND (
token = 'YyAVGEDNf3yC4JayCS8Qx0vPrzuoqWRHQb8ROqOcFuM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)