UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WGWRGoookWCXaBWGtWtDkTDXtylUyRIWuBLVTSJJqms=' 
WHERE 
  key_id = '50cc8f612e0ee190396be19de2418ee746ce09ea4f3545ab5b8d065c042012a7' 
  AND (
    token = 'WGWRGoookWCXaBWGtWtDkTDXtylUyRIWuBLVTSJJqms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026