UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kUoCzYEMgqTD31l17F7kNmhwbhv8Sn3W+PBLd1Czjd8='
WHERE
key_id = '2f81d856f16a8f155cf4d8beb91d5c9f77af405737373e82108c9a5f0dbbefa8'
AND (
token = 'kUoCzYEMgqTD31l17F7kNmhwbhv8Sn3W+PBLd1Czjd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)