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