UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5X+8GaPXICXK8i5h/NS6WLK1TT9Ua0LCBHX6K6mTOjM=' 
WHERE 
  key_id = 'b6bb65d71296354252a2cc7b2843ed58cbfc7d324970e8c8478c95f95fdad40f' 
  AND (
    token = '5X+8GaPXICXK8i5h/NS6WLK1TT9Ua0LCBHX6K6mTOjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045