UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w0NiLrIiHeCksLDjm/Kup7mFJBdVvqpNdUKdwu2VfPY=' 
WHERE 
  key_id = '6b660f2c95daf446776e8dcc50599466f3a100f99cad435d143a0d51777597d8' 
  AND (
    token = 'w0NiLrIiHeCksLDjm/Kup7mFJBdVvqpNdUKdwu2VfPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048