UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Z6cBPydZ5JfkOmftsllZ8qUHbngKZaXPFhJG11/SyA='
WHERE
key_id = '3074367b04abe92ba05733e972236b9d82fe21e7f3a0e290a5d03c2d2997ba4a'
AND (
token = '4Z6cBPydZ5JfkOmftsllZ8qUHbngKZaXPFhJG11/SyA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)