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