UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ILVZbL//S7O9JH7WkBr7I9PJCqCnHT1e2GXXXo89IZE=' 
WHERE 
  key_id = 'b40ebe55b6112b8f242910920991bcb6180dac4592011894b72324cfb5085c11' 
  AND (
    token = 'ILVZbL//S7O9JH7WkBr7I9PJCqCnHT1e2GXXXo89IZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049