UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kFksRD30ou2z0I+mbChhLJ5RfQx4kL1xJ79yKLeG2T4='
WHERE
key_id = 'ff708608195dffe3c4c6bc36d5e269a15d212a3113859e1fbb230a019d8a5f80'
AND (
token = 'kFksRD30ou2z0I+mbChhLJ5RfQx4kL1xJ79yKLeG2T4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)