UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fMyNyR0WWJjlE8T6T7npugfZqtA7OFAJrJb4RliawI8='
WHERE
key_id = 'e91e1802432725c008b05d6e6fc6c8c57335f7ad17711f88a396a4cc4bd6f119'
AND (
token = 'fMyNyR0WWJjlE8T6T7npugfZqtA7OFAJrJb4RliawI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)