UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KjhnCFsvDytXUSbPp/qpjo2OM0AAkwR86UK++2+8R6c=' 
WHERE 
  key_id = '2561e2490a794db912a2b9888db83d9b5bd831ad5fd75ed29f26f665172cd05e' 
  AND (
    token = 'KjhnCFsvDytXUSbPp/qpjo2OM0AAkwR86UK++2+8R6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022