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

Query time 0.00030