UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aWLiBquU1L8vAdHBmtuljGORoN6/E19wb/uVjNhMwcs=' 
WHERE 
  key_id = 'bdb5f62a75a1181334a338ab0f96c2362bd7514e167f4a5b5dfae8d4cfdc0f04' 
  AND (
    token = 'aWLiBquU1L8vAdHBmtuljGORoN6/E19wb/uVjNhMwcs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021