UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '62yglBGF0+rEcLbb1TlMHxH25mMWbeFWQ3N1xOrOeOg=' 
WHERE 
  key_id = '368d24a6f7f39a9bd62753af7a69d2e42eed4511f119856977cf6f87ec776f77' 
  AND (
    token = '62yglBGF0+rEcLbb1TlMHxH25mMWbeFWQ3N1xOrOeOg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037