UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6xbZ4AHhu/gT2RA1Y6d3VRuxCjS6i3h8EC7kbh1Cb2U='
WHERE
key_id = 'aa4d2e503880f424d157f6c6287cf8d107babb6f5ada7d79041e8e192f6fb1c1'
AND (
token = '6xbZ4AHhu/gT2RA1Y6d3VRuxCjS6i3h8EC7kbh1Cb2U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)