UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SUh7r8SNiNWD3BuAsUmFEAASf7OfAy2XUN6sytQzhW4='
WHERE
key_id = '0d628fe516c80e67b4214592f2efbb51a035a8b801735d229a85a8002aa56ac5'
AND (
token = 'SUh7r8SNiNWD3BuAsUmFEAASf7OfAy2XUN6sytQzhW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)