UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HlzhSp0xNd0jd8CPyJTgqSYGy1RoDal9ipGtV3NV5/s='
WHERE
key_id = 'a8bbeec349d238e40dec9ae920801b9261fcd1dbd1730014b491ce0c00ed1596'
AND (
token = 'HlzhSp0xNd0jd8CPyJTgqSYGy1RoDal9ipGtV3NV5/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)