UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zf+t5F2aQNhaYq5snB6yGtvX8t8DSLbt3JMCYYAu/dg=' 
WHERE 
  key_id = 'ca885b9bc5adf01854f0798c187ca7e2498446df97803ffd8004dee3b8cf7784' 
  AND (
    token = 'Zf+t5F2aQNhaYq5snB6yGtvX8t8DSLbt3JMCYYAu/dg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033