UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xrq3QjKH1ZwbzH47h4ImEscm0HumF85HtjjhNWrGfIo=' 
WHERE 
  key_id = '44c51d9ad2d4ad74530976576f76e3409b469cef5ca2470c149eb9230e765404' 
  AND (
    token = 'xrq3QjKH1ZwbzH47h4ImEscm0HumF85HtjjhNWrGfIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035