UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't+yoxE6dDvsUcWuPmly8cI3olNFMxdrhlsQ7+VYHSs4=' 
WHERE 
  key_id = '77410c1cb2cdbba8d34e4d789c251a5bf7b00f5c887721eb13d6c57f6d25037e' 
  AND (
    token = 't+yoxE6dDvsUcWuPmly8cI3olNFMxdrhlsQ7+VYHSs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043