UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sJs9T0Hq8EretZRAmCIT6yS1U+eO4VCbLMQ5dCwfXhk=' 
WHERE 
  key_id = '488e17dd33c7f079cb75e99e2322c4857cabe37161540f1475b0a0d33f1ebf52' 
  AND (
    token = 'sJs9T0Hq8EretZRAmCIT6yS1U+eO4VCbLMQ5dCwfXhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029