UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'avCdh+KeBf8z8LEQM6djfn+ALxKNhn5iV/lXxEP1ASk=' 
WHERE 
  key_id = '6125729946da97393607e62d0af48df04ef3636163a6b11570b676411f1cbd9c' 
  AND (
    token = 'avCdh+KeBf8z8LEQM6djfn+ALxKNhn5iV/lXxEP1ASk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025