UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NeuI6KfrX2OP+qqyaHg69WuEE7MxKStIh779RhPOUOE=' 
WHERE 
  key_id = 'd11701e1ac480ed73baa78b29cc3ea07e87ee45d4b765f5865305cdfe319a8ac' 
  AND (
    token = 'NeuI6KfrX2OP+qqyaHg69WuEE7MxKStIh779RhPOUOE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031