UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd9Gu3yXdUYo0BKXMbgoegMgTFeOlINZMf+/+CtvbAFE=' 
WHERE 
  key_id = '6e64bb917f9262a3f798bdbe052604e54a9f3ccdf601d2568451fbde32f47619' 
  AND (
    token = 'd9Gu3yXdUYo0BKXMbgoegMgTFeOlINZMf+/+CtvbAFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029