UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6fAltBMOXQDIfocOenQE9ABhASVgWsMXTLeB1CWLCA='
WHERE
key_id = '5c55b66e898c6f3807e19ff2e6dca5abbf69ff54312359e938de22b8a59af0ca'
AND (
token = 'S6fAltBMOXQDIfocOenQE9ABhASVgWsMXTLeB1CWLCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)