UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ultuJ4EIVCUtUKpVtjIGoUvX7QnVE022BNr0+h50XCo='
WHERE
key_id = '7ed273a7147df866b6c257a257420faf9ce0c9af315e5da7f6f8e99f854101cd'
AND (
token = 'ultuJ4EIVCUtUKpVtjIGoUvX7QnVE022BNr0+h50XCo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)