UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Eax5JflwR9b0pCbyytlMnxIuRGFPjXO+wlv0DPrMCE='
WHERE
key_id = 'd2ce0db6e05259abf3e14f38037f79a9911f4e991c4cf3e48a9b4b5fe98bd898'
AND (
token = '4Eax5JflwR9b0pCbyytlMnxIuRGFPjXO+wlv0DPrMCE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)