UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iJRBmLRD+hfN01nvwHZ1mYhs1DvkBDFO9s7qpE4jJp0=' 
WHERE 
  key_id = 'cd3cc6a63c247b67f2a3fb05fd690ab64bceda54b5e6f964c17fea0720937fa9' 
  AND (
    token = 'iJRBmLRD+hfN01nvwHZ1mYhs1DvkBDFO9s7qpE4jJp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044