UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6WNW8w/v83Q2rxc66F9YABXVz0Rx4IXxqKhgcoEWcL8='
WHERE
key_id = '7d5f24c537b511289f055d95b5bb01b2dd710172dd136ba5b5b77dd0b6437d40'
AND (
token = '6WNW8w/v83Q2rxc66F9YABXVz0Rx4IXxqKhgcoEWcL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)