UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Ip2PIHrXzFgUaxglpqpeqpmUKLb3mL9j3Uw6Zroxs8='
WHERE
key_id = 'a6cab56a957d2e68a3d7522e97c02cb92016c767fc752878c25090f4359631ad'
AND (
token = '8Ip2PIHrXzFgUaxglpqpeqpmUKLb3mL9j3Uw6Zroxs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)