UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W6hO3qdxOPbEA+zfhjni7Q5OyeCHnP80gDuFPhkOj6o='
WHERE
key_id = '5bc120180f7280a28e55d832b659892ee2856500cadd90a7154aaba25b3525cb'
AND (
token = 'W6hO3qdxOPbEA+zfhjni7Q5OyeCHnP80gDuFPhkOj6o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)