UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aU9bUMQSIw6WtD7Zl25eTocovdo8+gIrr40TZtdFQjE=' 
WHERE 
  key_id = '6622b72e03093da983849d0d1390976e291714bfe94f7a17dc36c3bed4939a07' 
  AND (
    token = 'aU9bUMQSIw6WtD7Zl25eTocovdo8+gIrr40TZtdFQjE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027